<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/4
  Time: 19:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>我的博客</title>
    <style>
        body {
            background-size: 100% 100%;
            margin: 0px;
        }
        #a {
            width: 100%;
            height: 50px;
            position: fixed;
            background-color: white;
        }
        div#a {
            width: 100%;
            padding-left: 40px;
            margin: 0 auto;
            background: aliceblue;
            border-bottom: 1px solid skyblue;
        }
        div#a a {
            float: left;
            color: black;
            width: 50px;
            margin: 0 auto;
        }
        div#a ul {
            list-style-type: none;
            float: left;
            height: 50px;
            padding: 0px 0px;
            margin: 0 auto;
        }
        div#a ul li {
            text-decoration: none;
            float: left;
            /*padding: 10px 0px 45px 0;*/
            margin-right: 20px;
        }
        div#a ul li a {
            width: 60px;
            text-decoration: none;
            font-size: 20px;
            padding-top: 10px;
            margin-left: 100px;
        }
        div#a ul li a:hover {
            color: red;
        }
        #d {
            float: left;
            width: 665px;
            margin-top: 1px;
            height: 1000px;
            margin-left: 350px;
        }
        #s {
            float: left;
            width: 185px;
            height: 550px;
            background: #eeeeee;
            position: fixed;
            margin-top: 55px;
            margin-left: 120px;
        }
        div#s ul {
            list-style-type: none;
            list-style-position: inherit;
            margin: 0px;
        }
        div#s ul li {
            text-decoration: none;
            padding: 20px 0px 20px 0px;
            width: 180px;
            height: 15px;
        }
        div#s ul li a {
            width: 100px;
            text-decoration: none;
            font-size: 15px;
            color: #333333;
        }
        .s1 {
            font-size: 20px;
        }
        div#s ul li:hover {
            background-color: LightSteelBlue;
            width: 180px;
            height: 15px;
        }
        div#h ul {
            list-style-type: none;
            list-style-position: inherit;
            padding: 8px;
            margin: 0px;

        }
        div#h ul li {
            text-decoration: none;
            float: left;
            font-size: 24px;
            padding: 13px 1px 2px 0px;
            font-weight: bold;
            color: #999999;
        }
        div#h ul li:hover {
            color: red;
        }
        section {
            margin: 0 auto;
            width: 600px;

        }
        article {
            margin-bottom: 1em;
            padding: 1em;
            box-shadow: 0 0 3px #999;
            background-color: white;
            border-radius: 10px;
        }
        #z {
            font-size: 17px;
            color: black;
            font-weight: bold;
            text-decoration: none;
        }
        #z:hover {
            color: red;
        }
        span {
            font-size: 12px;
            color: gray;
        }
        #z2 {
            font-size: 10px;
            color: gray;
        }
        #one {
            height: 90px;
            width: 300px;
        }
    </style>
</head>
<body>
    <div id="a">
        <ul class="aaa">
            <li align="center"><a href="#">首页</a></li>
            <li align="center"><a href="#">新闻</a></li>
            <li align="center"><a href="#">播客</a></li>
            <li align="center"><a href="#">专区</a></li>
            <li align="center"><a href="#">闪存</a></li>
            <li align="center"><a href="#">发现</a></li>
        </ul>
    </div>

    <div id="s">
        <ul>
            <li class="s1"><a href="#">首页</a></li>
            <li class="s1"><a href="#">我的收藏</a></li>
            <li class="s1"><a href="#">我的赞</a></li>
            <li><a href="#">热门博客</a></li>
            <li><a href="#">热门视频</a></li>
            <li><a href="#">最新博客</a></li>
            <li><a href="#">好友圈</a></li>
            <li><a href="#">特别关注</a></li>
            <li><a href="#">专属博客</a></li>
            <li><a href="#">群博客</a></li>
        </ul>
    </div>

    <div id="d">
        <section class="add">
            <header>
                <h3>添加文章</h3>
            </header>
<%--            ${pageContext.request.contextPath} 是绝对路径--%>
            <form action="${pageContext.request.contextPath}/post/add" method="post">
                <h3>添加文章</h3>
                <div>
                    <input type="text" name="title" placeholder="请输入标题">
                    <input type="text" name="author" placeholder="请输入作者">
                </div><br>
                <div>
                    <textarea name="content" placeholder="请输入内容内容" id="one"></textarea>
                </div><br>
                <div>
                    <button>发表文章</button>
                </div>
            </form>
        </section>

        <section class="posts">
            <c:forEach items="${posts}" var="post">
                <article>
<%--                    这里是点击标题跳转到此文章的详情页面--%>
                    <a target="_blank" style="color: chocolate"
                        href="${pageContext.request.contextPath}/post?id=${post.id}" id="z">
                        文章标题：${post.title}
                    </a>
                    <a href="${pageContext.request.contextPath}/post/del?id=${post.id}" style="margin-left: 300px">删除</a>
                    <p id="z2">
                        <span>来自（文章作者）：${post.author}</span><br><br>
                        发布时间：${post.created}
                    </p>
                    <p>
                        <span style="color: chocolate; font-size: 15px">文章内容：</span>
                        ${post.content}
                    </p>
                </article>
            </c:forEach>
        </section>
    </div>
</body>
</html>
